health=`smartctl -H $1 | grep -o PASSED` if [[ $health == "PASSED" ]] then echo "GOOD: $1" exit 0 else echo "Critical: $1" exit 2 fi